package com.itheima.goods.controller.user;

import com.itheima.goods.service.DishService;
import com.itheima.goods.vo.DishVO;
import com.itheima.result.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userDishController")
@RequestMapping("/user/dish")
@Slf4j
@Api(tags = "C端-菜品浏览接口")
public class DishController {

    @Autowired
    private DishService dishService;

    /**
     * 根据分类id查询菜品以及口味
     * @param categoryId
     * @return
     */
    @GetMapping("list")
    public Result list(Long categoryId){
        List<DishVO> dishVOs=dishService.fidByCategoryId(categoryId);
        return Result.success(dishVOs);
    }

}
